<template>
  <div
    :class="prefixCls"
    class="relative h-[100%] lt-md:px-10px lt-sm:px-10px lt-xl:px-10px lt-xl:px-10px"
  >
    <div class="relative mx-auto h-full flex">
      <!-- <div class="logo"></div> -->
      <div :class="isMobileDevice() ? 'sys-name2' : 'sys-name'" class="sys-name">
        <span>{{ title }}</span>
      </div>
      <div class="copy-right">星链天地开发团队 </div>

      <div class="relative flex-1 p-30px dark:bg-[var(--login-bg-color)] lt-sm:p-10px bjt">
        <div class="login-mark">
          <div
            class="flex items-center justify-between text-white at-2xl:justify-end at-xl:justify-end"
          >
          </div>
          <!-- 右边的登录界面 -->
          <Transition appear enter-active-class="animate__animated ">
            <div
              class="m-auto h-full w-[100%] flex items-center at-2xl:max-w-500px at-lg:max-w-500px at-md:max-w-500px at-xl:max-w-500px"
            >
              <!-- 账号登录 -->
              <LoginForm class="m-auto h-auto p-20px lt-xl:(rounded-3xl light:bg-white)" />
            </div>
          </Transition>
        </div>
        <!-- 右上角的主题、语言选择 -->
      </div>
    </div>
  </div>
</template>
<script lang="ts" setup>
import { underlineToHump } from '@/utils'

import { useDesign } from '@/hooks/web/useDesign'
import { useAppStore } from '@/store/modules/app'
import { ThemeSwitch } from '@/layout/components/ThemeSwitch'
import { LocaleDropdown } from '@/layout/components/LocaleDropdown'

import { LoginForm, MobileForm, QrCodeForm, RegisterForm, SSOLoginVue } from './components'

defineOptions({ name: 'Login' })
console.log(isMobileDevice())
function isMobileDevice() {
  var userAgent = navigator.userAgent || navigator.vendor || window.opera

  // 这里列举了一些常见的手机或平板的User Agent片段
  var mobileAgents = [
    'Android',
    'webOS',
    'iPhone',
    'iPad',
    'iPod',
    'BlackBerry',
    'IEMobile',
    'Opera Mini'
  ]

  for (var i = 0; i < mobileAgents.length; i++) {
    if (userAgent.indexOf(mobileAgents[i]) > -1) {
      return true // 是移动设备
    }
  }

  return false // 不是移动设备
}

const { t } = useI18n()
const appStore = useAppStore()
const { getPrefixCls } = useDesign()
const prefixCls = getPrefixCls('login')
const title = computed(() => appStore.getTitle)
</script>

<style lang="scss" scoped>
$prefix-cls: #{$namespace}-login;

.#{$prefix-cls} {
  overflow: auto;

  &__left {
    &::before {
      position: absolute;
      top: 0;
      left: 0;
      z-index: -1;
      width: 100%;
      height: 100%;
      background-image: url('@/assets/svgs/login-bg.svg');
      background-position: center;
      background-repeat: no-repeat;
      content: '';
    }
  }
}

.bjt {
  background: url('@/assets/imgs/system-3699542_1920.jpg') no-repeat center;
  background-size: 100% 100%;
}

.login-mark {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgb(0 0 0 / 30%);
}

.sys-name {
  position: absolute;
  // left: 50%;
  top: 15%;
  z-index: 9999;
  width: 100%;
  font-family: '\9ED1\4F53';
  font-size: 45px;
  font-weight: 700;
  // transform: translateX(-50%);
  color: #fff;
  color: transparent;
  text-align: center;
  background: linear-gradient(90deg, #d2f8fe, #fff, #c1d5fe);
  background-clip: text;
}

.sys-name2 {
  position: absolute;
  // left: 50%;
  top: 20%;
  z-index: 9999;
  width: 100%;
  font-family: '\9ED1\4F53';
  font-size: 20px;
  font-weight: 700;
  // transform: translateX(-50%);
  color: #fff;
  color: transparent;
  text-align: center;
  background: linear-gradient(90deg, #d2f8fe, #a3f0fe, #c1d5fe);
  background-clip: text;
}

.copy-right {
  position: absolute;
  bottom: 5%;
  left: 50%;
  z-index: 9999;
  font-size: 16px;
  color: #fff;
  transform: translateX(-50%);
}

.logo {
  position: absolute;
  top: 3%;
  left: 3%;
  z-index: 1000;
  width: 130px;
  height: 100px;
  background: url('@/assets/imgs/image.png');
  background-size: 100% 100%;
}
</style>
